Quicksort chapter javaScript added#770
Quicksort chapter javaScript added#770Sooraj-s-98 wants to merge 6 commits intoalgorithm-archivists:mainfrom
Conversation
|
Thanks for the chapter! I'll try to do chapter reviews over the weekend! |
|
|
||
| ##### Text | ||
|
|
||
| The text of this chapter was written by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). |
There was a problem hiding this comment.
I think this could be an instance where it wasn't by the amazing @leios
|
|
||
| {% method %} | ||
| {% sample lang="js" %} | ||
| [import:31-38, lang:"javascript"](Code/javascript/quicksort.js) |
There was a problem hiding this comment.
this seems like a restrictive range, why not the whole file?
| * [Verlet Integration](contents/verlet_integration/verlet_integration.md) | ||
| * [Quantum Systems](contents/quantum_systems/quantum_systems.md) | ||
| * [Split-Operator Method](contents/split-operator_method/split-operator_method.md) | ||
| * [Split-Operator Method](contents/split-operator_method/split-operator_method.md) |
| * [Jarvis March](contents/jarvis_march/jarvis_march.md) | ||
| * [Graham Scan](contents/graham_scan/graham_scan.md) | ||
| * [Jarvis March](contents/jarvis_march/jarvis_march.md) | ||
| * [Graham Scan](contents/graham_scan/graham_scan.md) |
| * [Bubble Sort](contents/bubble_sort/bubble_sort.md) | ||
| * [Bogo Sort](contents/bogo_sort/bogo_sort.md) | ||
| * [Merge Sort](contents/merge_sort/merge_sort.md) | ||
| * [Quick Sort](contents/quick_sort/quick_sort.md) |
There was a problem hiding this comment.
not seeing a merge_sort.md file added? is that intentional?
|
[lang: javascript] |
| } | ||
|
|
||
| function partition(arr, left, right) { | ||
| let middle = Math.floor((right + left) / 2), |
There was a problem hiding this comment.
It is good practice to use const instead of let for variables where the value doesn't change. (see let len on line 5 too)
There was a problem hiding this comment.
FYI, I'm not sure how important it is, but it's generally good practice to do something like:
...
let middle = Math.floor( left + (right - left)/2 ),
...
As this avoids the possibility of overflow (see here).
|
I realize it's been a year, but we are now willing to merge community chapters into the algorithm archive, so we can work on this if you are still willing to help! |
No description provided.